# Contributor: Stefan Wagner <stw@bit-strickerei.de>
# Maintainer:
pkgname=py3-pyphen
_pkgname=Pyphen
pkgver=0.14.0
pkgrel=1
pkgdesc="python-based dictionary hyphenator library"
url="https://www.pyphen.org"
arch="noarch"
license="GPL-2.0-or-later AND LGPL-2.1-or-later AND MPL-1.1"
depends="python3"
makedepends="py3-gpep517 py3-flit-core"
checkdepends="py3-pytest py3-pytest-cov py3-pytest-isort py3-pytest-xdist"
subpackages="$pkgname-pyc"
source="$_pkgname-$pkgver.tar.gz::https://github.com/Kozea/Pyphen/archive/$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py-pyphen" # Backwards compatibility
provides="py-pyphen=$pkgver-r$pkgrel" # Backwards compatibility

prepare() {
	default_prepare
	# disable pytest-flake8
	# https://github.com/tholo/pytest-flake8/issues/87
	sed -i 's/--flake8//' pyproject.toml
}

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/pyphen-$pkgver-py3-none-any.whl
}

sha512sums="
62fa5282d16cde7d64164610e2e2de098351d4fa9f04c6f37923d5e43f5123dbf2094561b6de4d7b5b2f92a3506164b0e915b9d1c147eb3b70352c9358d7d457  Pyphen-0.14.0.tar.gz
"
